package com.woniu.goods.service.imol;

import com.woniu.goods.mapper.GoodsMapper;
import com.woniu.goods.service.GoodsService;
import org.springframework.stereotype.Service;
import org.springframework.transaction.annotation.Transactional;

import javax.annotation.Resource;

@Service
public class GoodsServiceImpl implements GoodsService {
    @Resource
    private GoodsMapper goodsMapper;

    @Transactional // 开启事务
    @Override
    public boolean updateStock(int id, int stock) {
//        boolean b = goodsMapper.updateStock(id, stock);
//        System.out.println(1 / 0);
//        return false;
        return goodsMapper.updateStock(id, stock);
    }

}
